<%--
  Created by IntelliJ IDEA.
  User: gxd_01
  Date: 2024/12/25
  Time: 23:30
  To change this template use File | Settings | File Templates.
--%>
<%--文章列表界面--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的博客列表</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="../css/blog_list.css">
</head>
<body>
<!-- 导航栏 -->
<div class="nav">
    <img src="../images/touxiang.jpg" alt="">
    <span class="title">我的博客系统</span>
    <!-- 用来占据中间位置 -->
    <span class="spacer"></span>
    <a href="blog_list.jsp">主页</a>
    <a href="blog_edit.jsp">写博客</a>
    <a href="login.jsp">注销</a>
</div>

<!-- 版心 -->
<div class="container">
    <!-- 左侧个人信息 -->
    <div class="container-left">
        <div class="card">
            <img src="../Picture/touxiang.jpg" class="avtar" alt="">
            <h3>${user.name}</h3>
            <a href="${user.giteeUrl}">gitee 地址</a>
            <div class="counter">
                <span>文章</span>
                <span>分类</span>
            </div>
            <div class="counter">
                <span>${user.articleCount}</span>
                <span>${user.categoryCount}</span>
            </div>
        </div>
    </div>

    <!-- 右侧内容详情 -->
    <div class="container-right">
        <c:if test="${not empty errorMessage}">
            <div class="error-message">${errorMessage}</div>
        </c:if>
        <c:forEach items="${blogs}" var="blog">
            <!-- 每篇博客包含标题，摘要，时间 -->
            <article class="blog">
                <div class="title">${blog.title}</div>
                <div class="date"><fmt:formatDate value="${blog.date}" pattern="yyyy-MM-dd"/></div>
                <div class="desc">
                        ${blog.abstractText}
                </div>
                <a href="blog_content.jsp?blogId=${blog.id}" class="detail">查看全文 &gt;&gt;</a>
            </article>
        </c:forEach>

        <!-- 分页导航 -->
        <div class="pagination">
            <c:if test="${page > 1}">
                <a href="blog_list.jsp?page=${page - 1}">上一页</a>
            </c:if>
            <span>第 ${page} 页 / 共 ${totalPages} 页</span>
            <c:if test="${page < totalPages}">
                <a href="blog_list.jsp?page=${page + 1}">下一页</a>
            </c:if>
        </div>
    </div>
</div>
</body>
</html>
